<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>


<h1> Agregar Parada </h1>
<script>
    function validarTurnoManana(tm){
        if(tm.checked){
            tm.form.capacidadManana.readOnly=false;
            tm.form.horaManana.readOnly=false;
            tm.form.capacidadManana.value=1;
            tm.form.horaManana.value='00:00';
        }else{
            tm.form.capacidadManana.value=0;
            tm.form.capacidadManana.readOnly=true;
            tm.form.horaManana.value='';
            tm.form.horaManana.readOnly=true;
        }
    }
    
    function validarTurnoTarde(tt){
        if(tt.checked){
            tt.form.capacidadTarde.readOnly=false;
            tt.form.horaTarde.readOnly=false;
            tt.form.capacidadTarde.value=1;
            tt.form.horaTarde.value='00:00';
        }else{
            tt.form.capacidadTarde.value=0;
            tt.form.capacidadTarde.readOnly=true;
            tt.form.horaTarde.value='';
            tt.form.horaTarde.readOnly=true;
        }
    }
</script>
<html:javascript formName="Parada"/>
<html:form action="/Administrador/Paradas/Agregar?method=save" onsubmit="return validateParada(this)" >
    <table border="0">
        <tbody>
            <tr>
                <td>Nombre:</td>
                <td><html:text maxlength="40" property="nombre"/></td>
            </tr> 
            <tr>
                <td>Turnos:</td>
                <td>Turno de la manana:<html:checkbox property="turnoManana" onchange="return validarTurnoManana(this)" /></td> 
                <td>   Turno de la tarde:<html:checkbox property="turnoTarde" onchange="return validarTurnoTarde(this)" /></td>
            </tr>
            <tr>
                <td>Capacidad de turno de manana:</td>
                <td><html:text maxlength="10" property="capacidadManana" readonly="true" onkeypress="return validar_texto(event)" /></td>
            </tr>
            <tr>
                <td>Capacidad de turno de tarde:</td>
                <td><html:text maxlength="10" property="capacidadTarde" readonly="true" onkeypress="return validar_texto(event)" /></td>
            </tr>
            <tr>
                <td>Hora de turno de manana:</td>
                <td><html:text maxlength="10" property="horaManana" readonly="true" /></td>
            </tr>
            <tr>
                <td>Hora de turno de tarde:</td>
                <td><html:text maxlength="10" property="horaTarde" readonly="true" /></td>
            </tr>
        </tbody>
    </table>
    <div class="center"> 
        <html:reset styleId="boton">
            <bean:message key="boton.reset" />
        </html:reset>
        <html:submit styleId="boton" >
            <bean:message key="boton.agregar" />
        </html:submit>

        <BR/>
        <div id="alerta">
            <bean:write name="Parada" property="mensaje" filter="false"/>
        </div>
    </div>
</html:form>


